#include <Windows.h>
#include <conio.h>
#include <ctime>
#include <fstream>
#include <iostream>
#include <mmsystem.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <thread>
#include <vector>
#include <windows.h>
// #include "roles.cpp"
#include "Simulated_universe.h"
#include "attack.h"
#include "func.h"
#include "information1.h"
#include "main.h"
#include "music.h"
#include <cstring>
using namespace std;
// struct character{
//     string name;
//     int available=-1;
//     int HP;//血量
//     int ATK;//攻击
//     int DEF;//防御
//     int SPD;//速度
//     int CRIT_rate;//暴击
//     int CRIT_DMG;//爆伤
//     int Break_Effect;//击破特工
//     int Outgoing_Healing_Boost;//治疗加成
//     int Max_Energy;//最大能量
//     int Energy_Regeneration_rate;//能量回复效率
//     int Effect_Hit_Rate;//效果命中
//     int Effect_Res;//效果抵抗
// };
using namespace std;

extern int achievement1[100], form_yx, form_yy, easter_egg[100], opt[100],
    si_baodi, wu_baodi, arms_[100];
;
extern int map1[1100][1100];
extern int mapsize, pdchangerole;
extern char keyin;

// struct You{
//     int x,y;
//     int face;
//     string role;
//     character role_status[100];
// };

int axx, ayy;

void forw() {
    if (you.face == 1) {
        axx--;
    }
    if (you.face == 2) {
        ayy++;
    }
    if (you.face == 3) {
        axx++;
    }
    if (you.face == 4) {
        ayy--;
    }
    return;
}

void E_(int yx, int yy, int mode) {}

void Q_(int yx, int yy, int mode) {
    axx = you.x, ayy = you.y;
    if (you.role == "Firefly") {
        for (int i = 0; i <= 6; i++) {
            forw();
            map1[axx][ayy] = 119;
            _Clearscreen(0);
            print(axx, ayy, 1);
            Sleep(80);
        }
        Sleep(100);
        you.x = axx;
        you.y = ayy;
        map1[axx - 1][ayy] = 119;
        map1[axx - 1][ayy - 1] = 119;
        map1[axx - 1][ayy + 1] = 119;
        map1[axx - 2][ayy] = 119;
        map1[axx][ayy - 1] = 119;
        map1[axx][ayy - 2] = 119;
        map1[axx][ayy + 1] = 119;
        map1[axx][ayy + 2] = 119;
        map1[axx + 1][ayy] = 119;
        map1[axx + 1][ayy + 1] = 119;
        map1[axx + 1][ayy - 1] = 119;
        map1[axx + 2][ayy] = 119;
        _Clearscreen(0);
        print(you.x, you.y, 1);
        map1[axx][ayy] = 0;
        map1[axx - 1][ayy] = 0;
        map1[axx - 1][ayy - 1] = 0;
        map1[axx - 1][ayy + 1] = 0;
        map1[axx - 2][ayy] = 0;
        map1[axx][ayy - 1] = 0;
        map1[axx][ayy - 2] = 0;
        map1[axx][ayy + 1] = 0;
        map1[axx][ayy + 2] = 0;
        map1[axx + 1][ayy] = 0;
        map1[axx + 1][ayy + 1] = 0;
        map1[axx + 1][ayy - 1] = 0;
        map1[axx + 2][ayy] = 0;
        Sleep(600);
        _Clearscreen(0);
        // system("cls");
        print(you.x, you.y, 1);
    }
    //====}+- ====---}+-
    //   @          @
    if (you.role == "Raiden Mei") {
        map1[axx - 1][ayy - 3] = int('=');
        map1[axx - 1][ayy - 2] = int('=');
        map1[axx - 1][ayy - 1] = int('=');
        map1[axx - 1][ayy] = int('=');
        map1[axx - 1][ayy + 1] = int('}');
        map1[axx - 1][ayy + 2] = int('+');
        map1[axx - 1][ayy + 3] = int('-');
        _Clearscreen(0);
        print(you.x, you.y, 1);
        Sleep(500);
        map1[axx - 1][ayy - 6] = int('=');
        map1[axx - 1][ayy - 5] = int('=');
        map1[axx - 1][ayy - 4] = int('=');
        map1[axx - 1][ayy - 3] = int('=');
        map1[axx - 1][ayy - 2] = int('-');
        map1[axx - 1][ayy - 1] = int('-');
        map1[axx - 1][ayy] = int('-');
        map1[axx - 1][ayy + 1] = int('}');
        map1[axx - 1][ayy + 2] = int('+');
        map1[axx - 1][ayy + 3] = int('-');
        system("color 80");
        _Clearscreen(0);
        print(you.x, you.y, 1);
        map1[axx - 1][ayy - 6] = 0;
        map1[axx - 1][ayy - 5] = 0;
        map1[axx - 1][ayy - 4] = 0;
        map1[axx - 1][ayy - 3] = 0;
        map1[axx - 1][ayy - 2] = 0;
        map1[axx - 1][ayy - 1] = 0;
        map1[axx - 1][ayy] = 0;
        map1[axx - 1][ayy + 1] = 0;
        map1[axx - 1][ayy + 2] = 0;
        map1[axx - 1][ayy + 3] = 0;
        Sleep(500);
        for (int i = -3; i <= 3; i++) {
            map1[axx + i][ayy - i] = 210;
            you.x = axx + i + 1;
            you.y = ayy - i - 1;
            Sleep(3);
            _Clearscreen(0);
            print(axx, ayy, 1);
        }
        // getch();
        for (int i = 3; i >= -3; i--) {
            map1[axx - i][ayy - i] = 211;
            you.x = axx - i + 1;
            you.y = ayy - i + 1;
            Sleep(3);
            _Clearscreen(0);
            print(axx, ayy, 1);
        }
        // getch();
        for (int i = -5; i <= 5; i++) {
            map1[axx][ayy - i] = 210;
            // you.x=axx;you.y=ayy-i-1;
            // Sleep(5);
            _Clearscreen(0);
            print(axx, ayy, 1);
        }
        Sleep(50);
        for (int i = 3; i >= -3; i--) {
            map1[axx][ayy - i] = 213;
            map1[axx - 1][ayy - i] = 211;
            map1[axx + 1][ayy - i] = 210;
            you.x = axx;
            you.y = ayy - i - 1;
            Sleep(2);
            _Clearscreen(0);
            print(axx, ayy, 1);
        }
        // Sleep(50);
        for (int i = -7; i <= 7; i++) {
            map1[axx][ayy - i] = 212;
            you.x = axx;
            you.y = ayy - i - 1;
            Sleep(2);
            _Clearscreen(0);
            print(axx, ayy, 1);
        }
        Sleep(1000);
        system("color 48");
        // Sleep(20);
        for (int i = -3; i <= 3; i++) {
            for (int j = -7; j <= 7; j++) {
                map1[axx + i][ayy + j] = 0;
            }
        }
        _Clearscreen(0);
        system("color 07");
        you.x = axx;
        you.y = ayy;
        print(you.x, you.y, 1);
    }
}

int attack(int yx, int yy, int mode) {
    axx = you.x, ayy = you.y;
    forw();
    if (you.role == "trailblazer") {
        // char temp=map1[axx][ayy];
        map1[axx][ayy] = '+';
        _Clearscreen(0);
        print(you.x, you.y, 1);
        // if(temp=='!'){
        //     information2(axx,ayy,easter_egg,opt[1]);
        //     // system("pause");
        //     // print(yx,yy,1);
        // }
        Sleep(50);
        map1[axx][ayy] = 0;
        _Clearscreen(0);
        print(you.x, you.y, 1);
        // Sleep(50);
    } else if (you.role == "Raiden Mei" && you.role_status[2].arms_[2] == 1) {
        if (you.face == 1) {
            map1[you.x - 1][you.y] = '=';
            map1[you.x - 2][you.y] = '+';
            map1[you.x - 3][you.y] = '|';
            map1[you.x - 4][you.y] = '|';
            map1[you.x - 5][you.y] = '|';
            map1[you.x - 6][you.y] = '|';
            map1[you.x - 7][you.y] = '|';
            map1[you.x - 8][you.y] = '|';
            map1[you.x - 9][you.y] = '|';
            map1[you.x - 10][you.y] = '|';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x - 1][you.y] = 0;
            map1[you.x - 2][you.y] = 0;
            map1[you.x - 3][you.y] = 0;
            map1[you.x - 4][you.y] = 0;
            map1[you.x - 5][you.y] = 0;
            map1[you.x - 6][you.y] = 0;
            map1[you.x - 7][you.y] = 0;
            map1[you.x - 8][you.y] = 0;
            map1[you.x - 9][you.y] = 0;
            map1[you.x - 10][you.y] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 2) {
            map1[you.x][you.y + 1] = '=';
            map1[you.x][you.y + 2] = '+';
            map1[you.x][you.y + 3] = '-';
            map1[you.x][you.y + 4] = '-';
            map1[you.x][you.y + 5] = '-';
            map1[you.x][you.y + 6] = '-';
            map1[you.x][you.y + 7] = '-';
            map1[you.x][you.y + 8] = '-';
            map1[you.x][you.y + 9] = '-';
            map1[you.x][you.y + 10] = '-';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x][you.y + 1] = 0;
            map1[you.x][you.y + 2] = 0;
            map1[you.x][you.y + 3] = 0;
            map1[you.x][you.y + 4] = 0;
            map1[you.x][you.y + 5] = 0;
            map1[you.x][you.y + 6] = 0;
            map1[you.x][you.y + 7] = 0;
            map1[you.x][you.y + 8] = 0;
            map1[you.x][you.y + 9] = 0;
            map1[you.x][you.y + 10] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 3) {
            map1[you.x + 1][you.y] = '=';
            map1[you.x + 2][you.y] = '+';
            map1[you.x + 3][you.y] = '|';
            map1[you.x + 4][you.y] = '|';
            map1[you.x + 5][you.y] = '|';
            map1[you.x + 6][you.y] = '|';
            map1[you.x + 7][you.y] = '|';
            map1[you.x + 8][you.y] = '|';
            map1[you.x + 9][you.y] = '|';
            map1[you.x + 10][you.y] = '|';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x + 1][you.y] = 0;
            map1[you.x + 2][you.y] = 0;
            map1[you.x + 3][you.y] = 0;
            map1[you.x + 4][you.y] = 0;
            map1[you.x + 5][you.y] = 0;
            map1[you.x + 6][you.y] = 0;
            map1[you.x + 7][you.y] = 0;
            map1[you.x + 8][you.y] = 0;
            map1[you.x + 9][you.y] = 0;
            map1[you.x + 10][you.y] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 4) {
            map1[you.x][you.y - 1] = '=';
            map1[you.x][you.y - 2] = '+';
            map1[you.x][you.y - 3] = '-';
            map1[you.x][you.y - 4] = '-';
            map1[you.x][you.y - 5] = '-';
            map1[you.x][you.y - 6] = '-';
            map1[you.x][you.y - 7] = '-';
            map1[you.x][you.y - 8] = '-';
            map1[you.x][you.y - 9] = '-';
            map1[you.x][you.y - 10] = '-';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x][you.y - 1] = 0;
            map1[you.x][you.y - 2] = 0;
            map1[you.x][you.y - 3] = 0;
            map1[you.x][you.y - 4] = 0;
            map1[you.x][you.y - 5] = 0;
            map1[you.x][you.y - 6] = 0;
            map1[you.x][you.y - 7] = 0;
            map1[you.x][you.y - 8] = 0;
            map1[you.x][you.y - 9] = 0;
            map1[you.x][you.y - 10] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
    } else if (you.role == "Raiden Mei" && you.role_status[2].arms_[1] == 1) {
        if (you.face == 1) {
            map1[you.x - 1][you.y] = 'e';
            map1[you.x - 2][you.y] = 'f';
            map1[you.x - 3][you.y] = 'i';
            map1[you.x - 4][you.y] = 'n';
            map1[you.x - 5][you.y] = 'k';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x - 1][you.y] = 0;
            map1[you.x - 2][you.y] = 0;
            map1[you.x - 3][you.y] = 0;
            map1[you.x - 4][you.y] = 0;
            map1[you.x - 5][you.y] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 2) {
            map1[you.x][you.y + 1] = 'k';
            map1[you.x][you.y + 2] = 'n';
            map1[you.x][you.y + 3] = 'i';
            map1[you.x][you.y + 4] = 'f';
            map1[you.x][you.y + 5] = 'e';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x][you.y + 1] = 0;
            map1[you.x][you.y + 2] = 0;
            map1[you.x][you.y + 3] = 0;
            map1[you.x][you.y + 4] = 0;
            map1[you.x][you.y + 5] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 3) {
            map1[you.x + 1][you.y] = 'k';
            map1[you.x + 2][you.y] = 'n';
            map1[you.x + 3][you.y] = 'i';
            map1[you.x + 4][you.y] = 'f';
            map1[you.x + 5][you.y] = 'e';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x + 1][you.y] = 0;
            map1[you.x + 2][you.y] = 0;
            map1[you.x + 3][you.y] = 0;
            map1[you.x + 4][you.y] = 0;
            map1[you.x + 5][you.y] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
        if (you.face == 4) {
            map1[you.x][you.y - 1] = 'e';
            map1[you.x][you.y - 2] = 'f';
            map1[you.x][you.y - 3] = 'i';
            map1[you.x][you.y - 4] = 'n';
            map1[you.x][you.y - 5] = 'k';
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
            map1[you.x][you.y - 1] = 0;
            map1[you.x][you.y - 2] = 0;
            map1[you.x][you.y - 3] = 0;
            map1[you.x][you.y - 4] = 0;
            map1[you.x][you.y - 5] = 0;
            _Clearscreen(0);
            print(you.x, you.y, 1);
            Sleep(50);
        }
    }
    if (you.role == "Firefly") {
        if (you.face == 1) {
            map1[you.x - 1][you.y] = 119;
            map1[you.x - 2][you.y] = 119;
            you.x -= 3;
            _Clearscreen(0);
            print(you.x, you.y, 1);
        }
        if (you.face == 2) {
            map1[you.x][you.y + 1] = 119;
            map1[you.x][you.y + 2] = 119;
            you.y += 3;
            _Clearscreen(0);
            print(you.x, you.y, 1);
        }
        if (you.face == 3) {
            map1[you.x + 1][you.y] = 119;
            map1[you.x + 2][you.y] = 119;
            you.x += 3;
            _Clearscreen(0);
            print(you.x, you.y, 1);
        }
        if (you.face == 4) {
            map1[you.x][you.y - 1] = 119;
            map1[you.x][you.y - 2] = 119;
            you.y -= 3;
            _Clearscreen(0);
            print(you.x, you.y, 1);
        }
    }
    return 1;
}